package com.xzc.algorithm.data_structure_ke.ArrayList.queue;

import com.xzc.algorithm.data_structure_ke.ArrayList.array._1_Array;

public class NormalQueue<T> implements Queue<T> {

    private _1_Array<T> array;

    public NormalQueue(int capacity) {
        array = new _1_Array<>(capacity);
    }

    public NormalQueue() {
        this(10);
    }

    @Override
    public int getCapacity() {
        return array.getCapability();
    }

    @Override
    public boolean isEmpty() {
        return array.getSize() == 0;
    }

    @Override
    public int getSize() {
        return array.getSize();
    }

    @Override
    public void enqueue(T t) {
        array.addLast(t);
    }

    @Override
    public T dequeue() {
        return array.remove(0);
    }

    @Override
    public String toString(){
        return array.toString();
    }
}
